<?php
#####################################################
# RWCARDS - Joomla E-Cards Componment!
# Copyright (C) 2004/2005 by Ralf Weber
# Company    : LoadBrain
# Homepage   : www.weberr.de
# Version    : 2.2
# Date       : 23/11/2005
# License    : Released under GPL
######################################################

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

function com_install()
{
  global $database, $mosConfig_absolute_path;
	
    $queries = array(
      "UPDATE #__components SET `admin_menu_link` = '', admin_menu_img = '../administrator/components/com_rwcards/images/rwcards_icon.jpg'"
        ."\nWHERE `option` = 'com_rwcards' AND `parent` = 0",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/home.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=main'",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/config.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=config'",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/add_section.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=categories'",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/edit.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=cards'",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/media.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=upload'",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/mass_email.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=sentcards'",
      "UPDATE #__components SET `admin_menu_img` = 'js/ThemeOffice/credits.png'"
        ."\nWHERE `admin_menu_link` = 'option=com_rwcards&task=about'"
    );
    foreach ($queries as $query) 
	{
      $database->setQuery( $query );
      $database->query();
    }

       chdir($mosConfig_absolute_path . "/images/stories");
       $oldumask = umask(0);
       mkdir($mosConfig_absolute_path . "/images/stories/cards/", 0777);
       umask($oldumask);
			 
			 //captcha tmp dir
			 chdir($mosConfig_absolute_path . "/components/com_rwcards/captcha");
       $oldumask = umask(0);
       mkdir($mosConfig_absolute_path . "/components/com_rwcards/captcha/__TEMP__", 0777);
       umask($oldumask);
?>
  <center>
  <table width="100%" border="0">
    <tr>
      <td><img src="components/com_rwcards/images/admin_loadbrain.gif"></td>
      <td>
        <strong>RWCards - A Joomla E-Card Component</strong><br/>
        <font class="small">&copy; Copyright 2005 by Ralf Weber<br/>
        Released under the terms and conditions of the <a href="index2.php?option=com_admisc&task=license">GNU General Public License</a>.</font><br/>
      </td>
    </tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
    <tr>
      <td background="E0E0E0" style="border:1px solid #999;color:green;font-weight:bold;" colspan="2">Installation finished.</td>
    </tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
  </table>
  </center>
<?php	   
}
?>